home *** CD-ROM | disk | FTP | other *** search
- on newChap
- global gPathList, gNormSize, gNumPages, gSmallSize, gNewChap, gPatch, gPlace, gMode, gCurQuad, gPatchSnd, gType, gEsPatch
- if gPlace = #title then
- cursor(4)
- puppetSprite(13, 1)
- puppetSprite(14, 1)
- spriteBox(13, 280, 235, 478, 245)
- updateStage()
- end if
- set unit to ChapStr2Unit(gNewChap)
- set chapter to ChapStr2Chap(gNewChap)
- set language to ChapStr2Language(gNewChap)
- initFilter(language)
- set gPathList to findChapPaths(language, unit, chapter)
- set count to 0
- repeat while (gPathList = [:]) and (count < 1)
- alert("Chapter " & gNewChap & " is not currently available. Insert its disk and try again.")
- findChapLocs()
- set count to count + 1
- set gPathList to findChapPaths(language, unit, chapter)
- end repeat
- if gPathList = [:] then
- alert("Required chapter " & gNewChap & " not found. See system administrator.")
- goQuit()
- return 1
- end if
- set the text of cast "Menu Unit-Chapter" to string(((unit - 1) * 11) + chapter)
- set the text of cast "Play Unit-Chapter" to string(((unit - 1) * 11) + chapter)
- set path to getaProp(gPathList, #textPath)
- if gPlace = #title then
- spriteBox(14, 280, 235, 280 + 33, 245)
- updateStage()
- end if
- set info to readTextFast(path)
- if gPlace = #title then
- spriteBox(14, 280, 235, 280 + 66, 245)
- updateStage()
- end if
- if info = "Error" then
- alert("Error reading chapter text for " & gNewChap & ". Be sure the chapter is available.")
- return 1
- end if
- set lang to item 2 of info
- set the text of cast "Language" to lang
- set gNumPages to value(item 5 of info)
- set Font to item 6 of info
- if Font = "Rosetta Roman" then
- set Font to "Times New Roman"
- end if
- if (gType = #PC) and (Font = "Times") then
- set Font to "Times New Roman"
- end if
- set gNormSize to value(item 7 of info)
- set gSmallSize to value(item 8 of info)
- if getaProp(gPathList, #type) = 1 then
- set gPatch to gNewChap = "English 05-06"
- patchText(gNewChap)
- end if
- set gPatchSnd to gNewChap = "Russian 01-01"
- set gEsPatch to gNewChap = "Espa├▒ol 03-10"
- initQuads()
- if gPlace = #title then
- set gMode to "111"
- newPage(gCurQuad, unit, chapter, 1)
- repeat with i = 1 to 4
- if getPict(1) = 0 then
- alert("Error reading pictures for " & gNewChap & ". Be sure the chapter is available.")
- return 1
- end if
- spriteBox(14, 280, 235, 280 + ((i + 2) * 33), 245)
- updateStage()
- end repeat
- end if
- set titleFont to Font
- set the textFont of cast "Language" to titleFont
- if the textFont of cast "Language" <> titleFont then
- alert("This chapter requires the font " & titleFont & ". Another font will be substituted. Text may not appear correctly.")
- end if
- repeat with i = 0 to 2
- set the text of cast (42 + i) to " "
- set the textFont of cast (42 + i) to Font
- set the textSize of cast (42 + i) to gNormSize
- end repeat
- repeat with i = 0 to 3
- set the text of cast (49 + i) to " "
- set the textFont of cast (49 + i) to Font
- set the textSize of cast (49 + i) to gNormSize
- set the text of cast (113 + i) to " "
- set the textFont of cast (113 + i) to Font
- set the textSize of cast (113 + i) to gNormSize
- end repeat
- if gPlace = #title then
- puppetSprite(13, 0)
- puppetSprite(14, 0)
- cursor(-1)
- end if
- return 0
- end
-
- on readTextFast path
- global gType
- set txt to readTextFile(path)
- if gType = #PC then
- if item 6 of txt = "Times" then
- set txt to filterText(txt)
- else
- if item 6 of txt = "Cyrillic" then
- set txt to filterCyrillic(txt)
- else
- if item 6 of txt = "Rosetta Roman" then
- set txt to filterRosettaRoman(txt)
- end if
- end if
- end if
- end if
- if word 1 of txt = "#Error" then
- set info to "Error"
- else
- set the itemDelimiter to "@"
- set info to item 1 of txt
- repeat with i = 0 to 39
- set newline to item i + 2 of txt
- put newline into field (345 + i)
- end repeat
- set the itemDelimiter to ","
- end if
- return info
- end
-